<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>码客山威 - 后台管理系统</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/datepicker3.css" rel="stylesheet">
<link href="css/bootstrap-table.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">
<style type="text/css">
	.leftMenu {
		position: relative;
		font-weight: bold;
	}

	.leftMenu .right {

		position: absolute;
		top:auto;
		right:10px;

	}

	.list-group-item a  {
		padding-left: 20%;
		display: block;
		font-weight: lighter;
		cursor: pointer;
	}


	.green {
		background: rgb(50,197,210);
		color:white;
		margin-right: 5px;
	}

	.blue {
		background: rgb(53,152,220);
		color:white;
		margin-right: 5px;
	}

	.red {
		background: rgb(231,80,90);
		color:white;
		margin-right: 5px;
	}
</style>
<!--[if lt IE 9]>
<script src="js/html5shiv.js"></script>
<script src="js/respond.min.js"></script>
<![endif]-->

</head>

<body>
	<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
		<div class="container-fluid">
			<div class="navbar-header">
				<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#sidebar-collapse">
					<span class="sr-only">Toggle navigation</span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
					<span class="icon-bar"></span>
				</button>
				<a class="navbar-brand" href="#">&nbsp;<span>码客山威</span>&nbsp;后台管理系统</a>
			</div>
							
		</div><!-- /.container-fluid -->
	</nav>
		
			<!-- 左侧导航 -->
	<div id="sidebar-collapse" class="col-sm-3 col-md-3 col-lg-2 sidebar">
		<div class="table-responsive" style="margin-top:50px" role="tablist">
                    <ul class="nav menu leftMenu">
                        <!-- 利用data-target指定要折叠的分组列表 -->
                        <li id="list-heading" data-toggle="collapse" data-target="#list-group" role="tab" >
                            <a href="#">
                                门户管理
                                <span class="glyphicon glyphicon-chevron-down right"></span>
                            </a>
                        </li>
                        <!-- .panel-collapse和.collapse标明折叠元素 .in表示要显示出来 -->
                        <div id="list-group" class="panel-collapse collapse" role="tabpanel" aria-labelledby="list-heading">
                            <ul class="list-group pagelist">
                              <!-- <li class="list-group-item">
                          
                                <a page="public" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>门户公告管理
                                </a>
                              </li> -->
                              <!-- <li class="list-group-item">
                                <a page="menu" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>门户导航管理
                                </a>
                              </li> -->
                              <!-- <li class="list-group-item">
                                <a class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>门户链接管理
                                </a>
                              </li> -->
                              <li class="list-group-item">
                                <a page="carouse" permission="lunboManager" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>轮播图管理
                                </a>
                              </li>
                              <li class="list-group-item">
                                <a page="category" permission="categoryManager" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>板块管理
                                </a>
                              </li>
                              <li class="list-group-item">
                                <a page="special" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>专区管理
                                </a>
                              </li>
                            </ul>
                        </div>
                    </ul><!--panel end-->
                    <ul class="nav menu leftMenu">
                        <li id="list-heading-2" data-toggle="collapse" data-target="#list-group-2" role="tab" >
                            <a >
                                用户管理
                                <span class="glyphicon glyphicon-chevron-down right"></span>
                            </a>
                        </li>
                        <div id="list-group-2" class="panel-collapse collapse" role="tabpanel" aria-labelledby="list-heading-2">
                            <ul class="list-group pagelist">
                              <li class="list-group-item">
                                <a page="manage" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>管理组
                                </a>
                              </li>
                              <li class="list-group-item">
                                <a page="user" href="#" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>用户管理
                                </a>
                              </li>
                              <li class="list-group-item">
                                <a page="blackuser" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>黑名单管理
                                </a>
                              </li>
                              <li class="list-group-item">
                                <a href="#" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>用户留存
                                </a>
                              </li>
                            </ul>
                        </div>
                    </ul>  
                    <ul class="nav menu leftMenu">
                        <li class="panel-heading-3" id="collapseListGroupHeading2" data-toggle="collapse" data-target="#list-group-3" role="tab" >
                            <a href="#">
                                贴目管理
                                <span class="glyphicon glyphicon-chevron-down right"></span>
                            </a>
                        </li>
                        <div id="list-group-3" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panel-heading-3">
                            <ul class="list-group pagelist">                    
                              <li class="list-group-item">
                                <a page="content" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>内容管理
                                </a>
                              </li>
                              <li class="list-group-item">
                                <a href="#" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>删除封禁
                                </a>
                              </li>
                              <li class="list-group-item">
                                <a href="#" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>统计
                                </a>
                              </li>
                            </ul>
                        </div>
                    </ul>
                    <ul class="nav menu leftMenu">
                    	 <li class="panel-heading-5" id="collapseListGroupHeading2" data-toggle="collapse" data-target="#list-group-5" role="tab" >
                            <a href="#">
                                设置
                                <span class="glyphicon glyphicon-chevron-down right"></span>
                            </a>
                        </li>
                         <div id="list-group-5" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panel-heading-5">
                            <ul class="list-group pagelist">                    
                              <li class="list-group-item">
                                <a page="equip" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>设备管理
                                </a>
                              </li>
                            </ul>
                        </div>
                    </ul> 
                    <ul class="nav menu leftMenu">
                        <li class="panel-heading-4" id="collapseListGroupHeading2" data-toggle="collapse" data-target="#list-group-4" role="tab" >
                            <a href="#">
                                用户权限
                                <span class="glyphicon glyphicon-chevron-down right"></span>
                            </a>
                        </li>
                        <div id="list-group-4" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panel-heading-4">
                            <ul class="list-group pagelist">                    
                              <li class="list-group-item">
                                <a page="role" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>角色管理
                                </a>
                              </li>
                              <li class="list-group-item">
                                <a page="permission" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>权限管理
                                </a>
                              </li>
                              <li class="list-group-item">
                                <a href="#" class="menu-item-left">
                                    <span class="glyphicon glyphicon-triangle-right"></span>授权管理
                                </a>
                              </li>
                            </ul>
                        </div>
                    </ul>
                </div>
            </div>
	</div><!--/.sidebar-->
		
	<div id="viewDiv" class="col-sm-9 col-md-9 col-sm-offset-3 col-lg-10 col-lg-offset-2 main"></div>	<!--/.main-->

	<script src="js/jquery-1.11.1.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
	<script src="js/bootstrap-datepicker.js"></script>
	<script src="js/bootstrap-table.js"></script>
	<script src="js/jquery.base64.js"></script>
	<script src="js/data.js"></script>
	<script>

		load("default");

	    $(function(){
		    
			var isLogin = window.localStorage.getItem('isLogin');
			
			if(!isLogin) {
				window.localStorage.clear();
				window.localStorage.setItem('msg',"您还未登录，请重新登录");
				window.location.href="index";
			}
			
			$(".menu-item-left").each(function(index,div){
				var permission = $(div).attr('permission');
				if(permission && !filter(permission)) {
					$(div).parent().css("display","none");
				}
			});
			
			
        $(".panel-heading").click(function(e){
            /*切换折叠指示图标*/
            $(this).find("span").toggleClass("glyphicon-chevron-down");
            $(this).find("span").toggleClass("glyphicon-chevron-up");
        }); 

        $(".pagelist a").click(function(e){
            var bind = $(this).attr("page");
            	var permission = $(this).attr("permission");
            	
            	if(bind) {
            		load(bind);
            	} else {
            		load("default");
            	}
            })
        });
		
		function filter(permission) {
			var filters = new Array();
			var str = window.localStorage.getItem("permissions");

			if(str && str != "") {
				var myPermissions = str.split(" ");
				return myPermissions.contain(permission);
			}
			return false;
		}

        function load(page) {			
		 	$("#viewDiv").html('<object type="text/html" data="https://www.maksdu.com/admin/'+page+'" width="100%" height="1000px"></object>');
		}
		
		Array.prototype.contain = function(val)
		{
			 for (var i = 0; i < this.length; i++)
			{
			   if (this[i] == val)
			   {
				 return true;
			   }
			}
			return false;
		};
 
	</script>	
</body>

</html>
